from django.db import models

# Create your models here.


# class ContentCategory(models.Model):
#     """推广内容类别"""
#     name = models.CharField(max_length=50, verbose_name='名称')
#     key = models.CharField(max_length=50, verbose_name='类别键名')
#     create_time = models.DateTimeField(auto_now_add=True, verbose_name="创建时间")
#     update_time = models.DateTimeField(auto_now=True, verbose_name="更新时间")
#
#     class Meta:
#         db_table = 'tb_content_category'
#         verbose_name = '推广内容类别'
#         verbose_name_plural = verbose_name
#
#     def __str__(self):
#         return self.name


class Content(models.Model):
    """广告内容"""
    category = models.CharField(max_length=100 ,verbose_name='类别')
    title = models.CharField(max_length=100, verbose_name='标题')
    url = models.CharField(null=True,max_length=300, verbose_name='内容链接')
    image = models.ImageField(null=True, blank=True, verbose_name='图片')
    text = models.TextField(null=True, blank=True, verbose_name='内容')
    sequence = models.IntegerField(verbose_name='排序')
    status = models.BooleanField(default=True, verbose_name='是否展示')
    create_time = models.DateTimeField(auto_now_add=True, verbose_name="创建时间")
    update_time = models.DateTimeField(auto_now=True, verbose_name="更新时间")

    class Meta:
        db_table = 'tb_content'
        verbose_name = '推广内容'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.title


class Gedan(models.Model):
    '''歌单'''

    playlist=models.CharField(max_length=20,verbose_name='歌单名字')
    image=models.CharField(max_length=100,verbose_name='歌单图片')
    bofang=models.CharField(max_length=10,verbose_name='播放量')


    class Meta:
        db_table='tb_gedan'


class Gequ(models.Model):
    '''歌曲'''

    songname=models.CharField(max_length=20,verbose_name='歌曲名字')
    url=models.CharField(max_length=100,verbose_name='歌曲链接')
    artist=models.CharField(max_length=10,verbose_name='歌手')
    image=models.CharField(max_length=50,verbose_name='歌曲图片')
    gendan = models.ForeignKey(Gedan, max_length=10)

    class Meta:
        db_table='tb_gequ'
